<?php
namespace app\shop\controller\admin;

use app\admin\library\AdminController;

use app\shop\library\Member as M;


class Member extends AdminController{
    public function onIndex(){
        
        $this->pageTitle = '会员管理';
        $this->pageIcon = 'fa fa-user';

        $member = $this->model('Member');

        $this->set('statusOption',M::defineStatus());

        return $this->display();
    }

    public function onList(){
        $status = $this->post('status');
        $keywords = $this->post('keywords');
        $page = $this->post('page',$this->check('页码')->type('int')->default(1));


        $member = $this->model('Member');

        if ($status){
            $member->where('status',$status); 
        }

        if ($keywords){
            $member->where('mobile','like','%'.$keywords.'%');
        }

        $list = $member->page($page,30)->getData();

        return ['list'=>$list,'total'=>$member->total,'count'=>$member->pageCount];    
    }
}

